package enterprise.web_jpa_war.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @author <a href="mailto:Roman_Boiko@epam.com">Roman Boiko</a>
 */

@Entity   
@Table
public class Device {
	@Id
        @GeneratedValue(strategy = GenerationType.TABLE)
	private Long id;
	
	@ManyToOne(cascade = CascadeType.PERSIST)
	private PhysicalLocation physicalLocation;
	
	@Column(nullable=false)
	private String ip;

	public Device(){}
	
	public Device(PhysicalLocation physicalLocation, String ip) {
		super();
		this.physicalLocation = physicalLocation;
		this.ip = ip;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public PhysicalLocation getPhysicalLocation() {
		return physicalLocation;
	}

	public void setPhysicalLocation(PhysicalLocation physicalLocation) {
		this.physicalLocation = physicalLocation;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}
}
